<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1, user-scalable=no">
    <meta http-equiv="X-UA-Compatible" content="ie=edge,chrome=1">
    <meta name="author" content="最爱古风小雷丘">
    <title></title>
    <style>
        body{
            margin: 0;
        }
        .box{
            width: 180px;
            height: 180px;
            border: 1px solid lightgray;
            position: relative;
            margin: 100px auto;
        }
        ul{
            display: flex;
            position: absolute;
            margin: 0;
            padding: 0;
            list-style: none;
            left: 10px;
            top: 10px;
            transition: all 0.3s;
        }
        li{
            width: 160px;
            height: 160px;
            border: 1px solid;
            margin-right: 10px;
        }
        img{
            width: 160px;
            height: 160px;
        }

        .click span{
            display: inline-block;
            width: 30px;
            height: 30px;
            font-size: 25px;
            border: 1px solid;
            text-align: center;
            line-height: 30px;
        }
        .click{
            float: right;
            margin-right: 700px;
        }
    </style>
</head>
<body>
    <div class="box">
        <ul>
          <li class="left"><img src="xiaomi/img1.png" alt=""></li>
          <li class="right"><img src="xiaomi/img2.png" alt=""></li>
          <li class="right"><img src="xiaomi/img3.png" alt=""></li>
          <li class="right"><img src="xiaomi/img2.png" alt=""></li>
    </ul>
    </div>
    <div class="click">
        <span class="prev">&lt;</span><span class="next">&gt;</span>
    </div>

    <script src="jquery.js"></script>
</body>
</html>
<script>
    var index = 0;
    function change(){
        $('ul').css('left',-160*index)
    }
   
    function changeImg(){
        //  left = left == 10 ? -165 : 10 ;
        //  change();
    }
    function prevImg(){
        index = index <= 0 ? 0: index-1;
        change();
    }
    function nextImg(){
        index = index>=3  ? 3 : index+1;
        change();
    }
    //    var timer = setInterval(changeImg,1000)

    $('.click').find('.prev').click(function(){
        // clearInterval(timer)
        // timer = null;

        prevImg()
    })
    $('.click').find('.prev').mouseout(function(){
        // timer = setInterval(changeImg,1000)
    })
    $('.click').find('.next').click(function(){
        // clearInterval(timer)
        // timer = null;

        nextImg()
    })
    $('.click').find('.next').mouseout(function(){
        // timer = setInterval(changeImg,1000)
    })
</script>